import utils from './order-utils.js'
import listStatus from '../../../../tabBar/public/js/way-list-status.js';
export default {
	data() {
		return {
			list: [],
			orderKey: '',
			ispay: true,
			isewm: true,
			iseva: true,
		};
	},

	onLoad(option) {
		this.orderKey = option.orderKey;
		this.getOrderListData();
	},
	methods: {
		getSelect(row) {
			return listStatus.getSelect(row);
		},
		waybillStatus(rows) {
			return listStatus.status(rows);
		},
		getStatusP2(rows) {
			return listStatus.getStatusP2(rows);
		},
		getLevel(rows) {
			return listStatus.getLevel(rows);
		},
		getStatus(rows) {
			return listStatus.getStatus(rows);
		},
		getTransitStatus(rows) {
			return listStatus.getTransitStatus(rows);
		},
		getDestinationCity(rows) {
			return listStatus.getDestinationCity(rows);
		},
		getDisabledDel(rows) {
			return listStatus.getDisabledEdit(rows);
		},
		getDisabledEdit(rows) {
			return listStatus.getDisabledEdit(rows);
		},
		toDetail(item) {
			this.$util.redirectTo('/pages/order/order-detail/order-detail', {
				waybill_id: item.waybill_id,
				in_type: '4',
			});
		}, 
		// 订单列表
		getOrderListData() {
			var data = {
				waybill_sn: this.orderKey
			};
			var url = '';
			// if(this.orderKey.includes("T")){
			// 	url = this.api.order.scanGetWaybillLogApi;
			// 	data.source  = 'sf'; 
			// }else{
			// 	url = this.api.order.waybillLogApi;
			// }
			url = this.api.order.waybllListApi;
			this.http.sendRequest({
				api: url,
				data: data,
				success: res => {
					let newArr = [];
					let msg = res.message;
					if (res.code == 1 && res.data.data) {
						newArr = res.data.data;
					} else {
						this.$util.showToast({
							title: msg
						});
					}
					//设置列表数据
					// if (mescroll.num == 1){
						this.list = []; //如果是第一页需手动制空列表
					// } 
					this.list = this.list.concat(newArr); //追加新数据
					console.log(this.list);
					if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
				},
				fail: res => {
					mescroll.endErr();
					if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
				}
			});
		}
	}
};
